<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>
<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">

</head>
<body class="nav-md">
	<%@ include file="loginCheck.jsp"%>
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">
					<div class="clearfix"></div>
					<br />
				</div>
			</div>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="page-title">
						<div class="title_left">
							<h3>配置管理</h3>
						</div>
					</div>
					<div class="clearfix"></div>
					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="x_panel">
								<div class="x_title">
									<h2>修改账户信息以及相关配置</h2>
									<div class="clearfix"></div>
								</div>
								<div class="x_content">
									<form name="myForm" class="form-horizontal form-label-left"
										novalidate method="post" id="myForm">
										<p>
											请谨慎修改相关信息，如有修改错误请及时
											<code>联系客服</code>
											以帮助您完成相关配置
										</p>
										<span class="section">淘客配置</span>
										<div class="item form-group" style="display: none">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">id<span class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="id" name="id"
													class="form-control col-md-7 col-xs-12" type="text"
													value="${users.id}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">蘑菇街Uid <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="mgjUid" class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="mgjUid" placeholder="例如：1emk6co" required="required"
													   type="text" value="${users.mgjUid}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">蘑菇街AppKey <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="mgjAppkey" class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="mgjAppkey" placeholder="例如：113145" required="required"
													   type="text" value="${users.mgjAppkey}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">蘑菇街AppSecert <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="mgjAppsecret" class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="mgjAppsecret" placeholder="例如：5A48F5DC922D38355BA0777774F38392" required="required"
													   type="text" value="${users.mgjAppsecret}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">网易考拉UnionId <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="klUnionid" class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="klUnionid" placeholder="例如：zhuanke_7005975075" required="required"
													   type="text" value="${users.klUnionid}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">苏宁易购AppKey <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="snAppkey" class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="snAppkey" placeholder="例如：7fca2a32cd4950b1520cef25f81f1d20" required="required"
													type="text" value="${users.snAppkey}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">苏宁易购AppSecert <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="snAppsecret"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="snAppsecret"
													placeholder="例如：906b3610e12d2281309dea1217209299"
													required="required" type="text" value="${users.snAppsecret}">
											</div>
										</div>
										<div class="ln_solid"></div>
										<div class="form-group">
											<div class="col-md-6 col-md-offset-3">
												<a type="submit" class="btn btn-primary"
													href="javascript:void(0)"
													onclick="history.back(-1);">取消</a> <input
													id="revise" type="button" class="btn btn-success"
													value="修改" onclick="ajaxPost()">
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- /page content -->
	<!-- 上传图片并修改 -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<script type="text/javascript">
		// ajax 对象
		function ajaxObject() {
			var xmlHttp;
			try {
				// Firefox, Opera 8.0+, Safari
				xmlHttp = new XMLHttpRequest();
			} catch (e) {
				// Internet Explorer
				try {
					xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					try {
						xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					} catch (e) {
						alert("您的浏览器不支持AJAX！");
						return false;
					}
				}
			}
			return xmlHttp;
		}

		function ajaxPost() {
			var id = $("#id").val();
			var mgjUid = $("#mgjUid").val();
			var mgjAppkey = $("#mgjAppkey").val();
			var mgjAppsecret = $("#mgjAppsecret").val();
			var klUnionid = $("#klUnionid").val();
			var snAppkey = $("#snAppkey").val();
			var snAppsecret = $("#snAppsecret").val();
			var ajax = ajaxObject();
			ajax.open("post", "other_allocations_do_update?id=" + id +
					"&mgjUid=" + mgjUid +
					"&mgjAppkey=" + mgjAppkey +
					"&mgjAppsecret=" + mgjAppsecret +
					"&klUnionid=" + klUnionid +
					"&snAppkey=" + snAppkey +
					"&snAppsecret=" + snAppsecret, false);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function () {
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
						var result = ajax.responseText;
						if (result == "1") {
							//请求成功
							alert("修改成功");
							location.href = "allocations_index";
						} else {
							//创建失败
							alert("修改失败，请重新操作");
						}
					} else if (ajax.status == 0) {
						//请求失败
						alert("您使用的火狐浏览器不支持本次操作，请更换浏览器重试");
					} else {
						//请求失败
						alert("请求终止，请检查操作或联系客服咨询" + ajax.status);
					}
				} else {
				}
			};
			ajax.send();

		}
	</script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
</body>
</html>